package com.cx.base.day12_framework.list.linkedlist;

/**
 * @Author: robert.song
 * @Date: Created in 2021/8/19
 */
public class LinkedList01_双向链表 {
    public static void main(String[] args) {
        Node jack = new Node("jack");
        Node tom = new Node("tom");
        Node lora = new Node("lora");
        Node robert = new Node("robert");
        Node bomb = new Node("bomb");
//        next赋值
        jack.next = tom;
        tom.next = lora;
        lora.next = robert;
        robert.next = bomb;
        bomb.next = jack;
//        prev赋值
        bomb.prev = robert;
        robert.prev = lora;
        lora.prev = tom;
        tom.prev = jack;
        jack.prev = bomb;
//        头尾定义
        Node first = jack;
        Node last = bomb;
//        测试，从头到尾遍历
        while (true) {
            if (first == null) {
                break;
            }
//            输出first信息
            System.out.println(first);
            first = first.next;
        }
    }
}
